package org.kazuhiko.rpg.manager;

import java.util.HashMap;

import org.kazuhiko.rpg.core.types.TextureType;
import org.newdawn.slick.opengl.Texture;

public class TextureManager
{
	
	
	private static TextureManager instance;
	
	private HashMap<TextureType, Texture> textures;
	
	public static TextureManager getManager()
	{
		if( instance == null )
		{
			instance = new TextureManager();
		}
		
		return instance;
	}
	
	private TextureManager()
	{
		textures = new HashMap<TextureType, Texture>();
	}
	
	public void addTexture( Texture texture, TextureType type )
	{
		if( textures.containsKey( type ) )
		{
			textures.remove( type );
		}
		
		textures.put( type, texture );
	}
	
	public Texture getTexture( TextureType type )
	{
		Texture ret = null;
		
		if( textures.containsKey( type ) )
		{
			ret = textures.get( type );
		}
		
		return ret;
	}
}
